package com.example.springsecurity.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @Author: anwenbiao
 * @Description: TODO
 * @DateTime: 2023/2/421:47
 */
@Data
@AllArgsConstructor(staticName = "create")
public class R<T> {
    private Integer code;

    private String message;

    private T data;
    
    public static <T> R<T> success(String message, T data){
        return create(0, message, data);
    }
    
    public static <T> R<T> success(){
        return create(0, "操作成功", null);
    }

    public static <T> R<T> success(T data){
        return create(0, "操作成功", data);
    }
    
    public static R faild(){
        return create(-1, "操作失败", null);
    }

    public static <T> R<T> faild(String message){
        return create(-1, message, null);
    }
    
}
